package com.pitop.base.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by lixin on 2018/6/23.
 */
@Configuration
public class ContextConfiguration extends WebMvcConfigurerAdapter {

    /**
     * 登录拦截器
     *
     * @return SupportLoginInterceptor
     */
    @Bean
    public SupportLoginInterceptor loginInterceptor() {
        return new SupportLoginInterceptor();
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //登录拦截器
//        registry.addInterceptor(loginInterceptor())
//                .addPathPatterns("/**")
//                .excludePathPatterns("/swagger-resources/**", "/login/**", "/res/**", "/frontendI18n/**", "/errorcodeLocal/**");

        super.addInterceptors(registry);
    }
}
